package com.s64.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.s64.entity.Book;
import com.s64.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/books")
public class BookController {
    @Autowired
    private BookService bookService;


    @GetMapping
    public List<Book> getAll() {
        List<Book> list = bookService.list(Wrappers.lambdaQuery(Book.class).eq(Book::getSecondsKill, 1));
        return list;
    }
}
